package sany.iec.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
import org.apache.commons.lang3.StringUtils;

/**
 *
 * @Author 托马斯
 * @Date 2025/7/5 22:29
 * @Description ServerType
 */
@AllArgsConstructor
@Getter
@ToString
public enum ServerType {

    IEC104("IEC104", "IEC104协议"),

    MODBUS("MODBUS", "MODBUS协议"),

    ;

    private final String type;

    private final String description;

    public static ServerType getServerType(String type) {
        if (StringUtils.isBlank(type)) {
            return null;
        }
        for (ServerType serverType : ServerType.values()) {
            if (serverType.getType().equals(type)) {
                return serverType;
            }
        }
        return null;
    }

}
